﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
@section Content{
    <style>
        .checkbox-inline, .radio-inline {
            line-height: 20px;
        }
    </style>
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        if (!!keyValue) {
            $.ajax({
                url: "/OrderFlowManage/ClientOrder/GetCitysJson",
                data: {},
                dataType: "json",
                async: false,
                success: function (data) {
                    //console.log(JSON.stringify(data))
                    initOrderInfo(data);
                }
            });
            
        }
    });

    function initOrderInfo(citys) {
        $.ajax({
            url: "/OrderFlowManage/ClientOrder/GetOrderInfoJson",
            data: { keyValue: keyValue },
            dataType: "json",
            async: false,
            success: function (data) {
                //console.dir(data);
                // 处理多个城市的需求。
                var arr = data.F_ActivityCityId.indexOf(',') == -1 ? [data.F_ActivityCityId] : data.F_ActivityCityId.split(',');
                var result = [];
                for (var i = 0; i < citys.length; i++) {
                    var ele = citys[i];
                    for (var j = 0; j < arr.length; j++) {
                        var val = arr[j];
                        if (val == ele.Value) {
                            result.push(ele.Text);
                        }
                    }
                }
                data.F_ActivityCityName = result.toString();

                $("#form1").formSerialize(data);
            }
        });
    }

    function submitForm() {
        var frameid = $.request("frameid");
        var radios = $("#closeOrderType").find("input[type='radio']:checked");
        if (!radios.length) {
            $.modalAlert("请选择您要关闭的原因！", 'warning');
            return false;
        }

        if (!$('#form1').formValid()) {
            return false;
        }

        $.submitForm({
            url: "/OrderFlowManage/ClientOrder/SubmitSignOutClientOrderForm?keyValue=" + keyValue,
            param: {
                F_OrderId: keyValue,
                F_ChangeType: 3,
                F_ChangeReason: radios.val(),
                F_Note: $("#closeOrderRemark").val()
            },
            success: function () {
                top.frames[frameid].$("#gridList").trigger("reloadGrid");
                $.closeTab();
                $.loading(false);
                //$.modalClose();
            }
        });
    }
</script>

<form id="form1">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">
                    <span class="h4">关闭订单原因</span>
                </th>
                <td class="formValue" colspan="5"></td>
            </tr>
            <tr>
                <th class="formTitle">活动主题：</th>
                <td class="formValue" colspan="5">
                    <input id="F_ActivityTheme" name="F_ActivityTheme" type="text" class="form-control" disabled />
                </td>
            </tr>
            <tr>
                <th class="formTitle">活动方公司：</th>
                <td class="formValue">
                    <input id="F_ClientName" name="F_ClientName" type="text" class="form-control" disabled />
                </td>
                <th class="formTitle">联系人：</th>
                <td class="formValue">
                    <input id="F_Contact" name="F_Contact" type="text" class="form-control" disabled />
                </td>
                <th class="formTitle">联系电话：</th>
                <td class="formValue">
                    <input id="F_Phone" name="F_Phone" type="text" class="form-control" disabled />
                </td>
            </tr>
            <tr>
                <th class="formTitle">活动城市：</th>
                <td class="formValue">
                    <input id="F_ActivityCityName" name="F_ActivityCityName" type="text" class="form-control" disabled />
                </td>
                <th class="formTitle">活动类型：</th>
                <td class="formValue">
                    <input id="F_ActivityTypeName" name="F_ActivityTypeName" type="text" class="form-control" disabled />
                </td>
                <th class="formTitle"></th>
                <td class="formValue"></td>
            </tr>
            <tr>
                <th class="formTitle">关闭原因：</th>
                <td id="closeOrderType" name="closeOrderType" class="formValue" colspan="5">
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio1" value="1" />客户不提供活动详细信息
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio2" value="2" />联系不到客户
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio3" value="3" />预算太低
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio4" value="4" />客户选择其他场地
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio5" value="5" />无场地推荐
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio6" value="6" />比稿失败
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio7" value="7" />客户跳单
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio8" value="8" />活动取消 
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio9" value="9" />撞单 
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio10" value="10" />其他
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="closeOrderOptions" id="closeOrderRadio11" value="11" />重复数据
                    </label>
                </td>
            </tr>
            <tr>
                <th class="formTitle">备注：</th>
                <td class="formValue" colspan="5">
                    <textarea id="closeOrderRemark" name="closeOrderRemark" class="form-control required" rows="4" style="width: 96%;"></textarea>
                </td>
            </tr>
        </table>
    </div>
</form>


